package com.gao.udp;

import java.io.IOException;
import java.net.*;
import java.util.Scanner;

/**
 * @Author: ShanYuqing
 * @Version: v1.0
 */
public class Send1 {
    public static void main(String[] args) throws IOException {
        DatagramSocket socket = new DatagramSocket(8888);
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("请输入信息：");
            String msg = sc.nextLine();
            if("886".equals(msg)){
                break;
            }
            byte[] bytes = msg.getBytes();
            DatagramPacket packet =new DatagramPacket(bytes,bytes.length,
                    InetAddress.getByName("127.0.0.1"),3333);
            socket.send(packet);
        }
        socket.close();
    }
}
